// 上传图片
export function uploadPictures(files) {
  console.log('上传的文件', files)
  var p = new Promise(function (resolve, reject) {
    var url = 'https://bootapi.51bmj.cn/bmj-api/api/home/upload';
    var xhr = new XMLHttpRequest();
    xhr.open('POST', url, true);
    xhr.onload = function () {
      // 请求完成
      if (this.status === 200) {
        var data = JSON.parse(xhr.responseText);
        if (data.success == true) {
          resolve(data);
        } else {
          resolve('上传失败');
        }
      } else {
        resolve('上传失败');
      }
    };
    var formdata = new FormData();
    formdata.append('biz', 'test');
    formdata.append('file', files);
    xhr.send(formdata);
  });
  return p;
}